package com.stone.sys.action;

/**
 * <pre>
 * 工作量统计维护
 * @author jz
 * </pre>
 */

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.stone.para.IConstant;
import com.stone.sys.pojo.TGzltjPara;
import com.stone.sys.service.UserService;
import com.stone.utils.DateFormatTool;

import frm.ssh.action.BaseAction;
import frm.ssh.exception.AppException;

public class GzltjParaAction extends BaseAction {
	
	private static final long serialVersionUID = -4647594073681054487L;

	private UserService userService;
	
	private TGzltjPara entity;
	
	/**
	 * 进入详细页面
	 * @return
	 * @throws AppException
	 */
	public String initDetail() throws AppException {
		
		List<TGzltjPara> list = userService.findListByHql("from TGzltjPara");
		
		 // 修改
		 if (list.size() > 0) {
			
			this.entity = list.get(0);

			// 新建进入
		} else {
			this.entity = new TGzltjPara();
			this.entity.setId(Long.parseLong("0"));
		}

		return SUCCESS;
	}
	
	/**
	 * 保存
	 * @return
	 * @throws AppException
	 */
	public String save() throws AppException {
		
		// 新建时
		if (entity.getId() == 0) {
			userService.save(entity);	
			
		} else {
			
			userService.update(entity);
			
		}
		
		super.setInfo("保存成功");
		
		return SUCCESS;
	}


	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public TGzltjPara getEntity() {
		return entity;
	}

	public void setEntity(TGzltjPara entity) {
		this.entity = entity;
	}
	
	


}
